package cn.zhaoguang.usedcar.common.http;

import lombok.Data;

/**
 * @Description 统一结果返回
 * @Author zhaoguang
 * @Date 2021/3/8 1:05
 */
@Data
public class ResultVO {

    private int code;
    private String msg;
    private  Object data;

    public ResultVO() {
    }
    public ResultVO(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    // 成功返回处理
    public static ResultVO success(String msg) {
        return new ResultVO(200, msg, null);
    }
    public static ResultVO success(String msg, Object obj) {
        return new ResultVO(200, msg, obj);
    }

    // 失败返回
    public static ResultVO error(String msg) {
        return new ResultVO(500, msg, null);
    }
    public static ResultVO error(String msg, Object obj) {
        return new ResultVO(500, msg, obj);
    }
}
